FS Command Action

The FS Command action provides a general method for Flash to send a message to whatever program is hosting the Flash player. This is advanced functionality, not for the average user.

FS Commands are not very reliable as they don't work on many browsers. You are actually better passing the info from the SWF to the browser using javscript. Likewise, you are better off using action script for interactivity. There are a very select few instances where this is not the case.

In a web browser, FS Command calls the FS Command Javascript function. In Director, FS Command sends a message interpreted as events by Lingo. In Authorware, FS Command sends commands to the scripting environment. In Visual Basic and Visual C++, FS Command sends a VB Event with two strings.

This is a tutorial explaining how to use the actionscript function FS Command to call Javascript functions from within Flash: http://www.flashkit.com/cgi-bin/tutorials/jump.cgi?ID=584.

The FS Command was developed in Flash for 2 reasons.
1. To allows SWFs to talk to Live Connect and Active X.
2. When tt was implemented IE did not support Javascript: Commands as URLs. At that time FS Commands were the only way to pass information to IE 3.0 or lower.

The early versions of Flash, Flash 3 or lower, had a very limited scripting environment, to see just how limited download a shareware trial of Flash 3. If you wanted to script something you had to use FS Commands and Flash Player Methods to do it. Since the authors of the Macromedia Technotes wrote that the way to communicate with Flash was through FS Commands all of the following Flash book authors stuck to that story, which is untrue. Most FS Command tutorials on the web confuse FS Commands with Flash Player Methods.

FS Commands pass a variable and an argument to the native scripting language. With the exception of projector files, which have some limited commands built in, you must script the commands yourself. You need to be aware that there is no Active X support for IE for Mac, Netscape, Mozilla, and most open sourced browsers. Also Linux browsers are dropping Live Connect. Therefore the use of FS Commands for web page usage is problematic.

The most common use for a FS Command is in the use of projectors. These commands are quite easily called by using the following command words in the FS Command box and the following arguments in the argument box. It is important that you start the command with "FS Command:".

Command Arguments:
Quit None
FullScreen True/ False
AllowScale True/False
ShowMenu True/False
Exec Path of EXE you want launched.
Save File Name
Quit- Shuts down the Player
FullScreen- Makes your projector Full Screen if set to true and makes it regular if set to false.
AllowScale- Allows your Graphics to scale with the projector or not.
ShowMenu- Shows the Projector Menu or eliminates it.
Exec- Launches any EXE if you are working on a MAC it launches and applescript. You must know the Path of the program. Save- Only available in the Flash 5 Standalone Player and may be removed at anytime without notice. It saves all of your variables to a txt file in the root directory.

Many projector enhancement programs like Flash Tools, SWF Studio, Swish Canvas, Jugglor, Flashants FMProjector have custom FS Commands built into them. Be sure to read the documentation carefully before implementing one of these specialized FS Commands. Outside of browser non-support for FS Commands, there is one good reason to use them to communicate with your HTML. This one good reason is that FS Commands do not cause your web browser to click when the command is issued like Javascript commands do.

In order to use FS Commands you must have this on your page:

<script=;"javascript;"> function navmovie_DoFSCommand(command, args) {

if ( command == "init" ) {

var buttons = parent.InternetExplorer ? window.navmovie : window.document.navmovie; if (buttons != null ) {

buttons.GotoFrame(parent.targetFrame);

// This function ensures that the navigation bar movie is set to the proper
// keyframe when it initially loads. The argument init is the name you use
// as the command paramter for the action attached to the first keyframe // in the navigation bar movie.
} } // Hook for Internet Explorer
if (navigator.appName &&
navigator.appName.indexOf("Microsoft") != -1 &&
navigator.userAgent.indexOf("Windows") != -1 &&
navigator.userAgent.indexOf("Windows 3.1") == -1) {
document.write('<SCRIPT LANGUAGE=VBScript>');
document.write('on error resume next ');
document.write('Sub fscommand_FSCommand(ByVal command, ByVal args) ');
document.write(' call fscommand_DoFSCommand(command, args) ');
document.write('end sub ');
document.write('</SCRIPT> ');
}
//--></SCRIPT>
</SCRIPT>

Notice that you have to have some VB on your page to catch the FS Commands from Active X. Now this is important. A FS Command is only a variable and a value when sent to a program. You must build the proper handler for your command and arguments with Javascript.

Okay now the final use which is probably the most useful use of FS Commands is for in custom programs that use Flash as the interface such as Authorware and VB projects.

This is handled by the Active X Flash method:

FSCommand(command, args)

Generated when a FS Command action is performed in the movie with a URL and the URL starts with FS Command :. Use this to create a response to a frame or button action in the Flash movie.